<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.weifly.jettycn.domain.Catalog" %>
<%@ page import="com.weifly.jettycn.util.TreeNode" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>

<div class="sidebar1">
  <h3>
    <span>项目分类</span>
  </h3>
  <dl>
<%
	// 第一级
	List catalogList = (List)request.getAttribute("catalogList");
	for(int i=0;i<catalogList.size();i++){
		TreeNode treeNode = (TreeNode)catalogList.get(i);
		Catalog catalog = (Catalog)treeNode.getTarget();
		String counter = treeNode.getCounter()>0 ? " ("+treeNode.getCounter()+") " : "";
%>
    <dt><a href="<%=request.getContextPath()%>/project/main.do?catalog=<%=catalog.getCatalogid()%>"><%=catalog.getName()%></a><%=counter %></dt>
<%
		// 第二级
		List subList = treeNode.getChildList();
		if(subList!=null && !subList.isEmpty()){
%>
    <dd>
      <ul>
<%
			for(int j=0;j<subList.size();j++){
				TreeNode subNode = (TreeNode)subList.get(j);
				Catalog subCata = (Catalog)subNode.getTarget();
				String subCounter = subNode.getCounter()>0 ? " ("+subNode.getCounter()+") " : "";
%>
        <li><a href="<%=request.getContextPath()%>/project/main.do?catalog=<%=subCata.getCatalogid()%>"><%=subCata.getName()%></a><%=subCounter %></li>
<%
				// 第三级
				List ssubList = subNode.getChildList();
				if(ssubList!=null && !ssubList.isEmpty()){
%>
        <ul>
<%
					for(int t=0;t<ssubList.size();t++){
						TreeNode ssubNode = (TreeNode)ssubList.get(t);
						Catalog ssubCata = (Catalog)ssubNode.getTarget();
						String ssubCounter = ssubNode.getCounter()>0 ? " ("+ssubNode.getCounter()+") " : "";
%>
          <li><a href="<%=request.getContextPath()%>/project/main.do?catalog=<%=ssubCata.getCatalogid()%>"><%=ssubCata.getName()%></a><%=ssubCounter %></li>

<%
					}
%>
        </ul>
<%
				}
%>

<%
			}
%>
      </ul>
    </dd>
<%
		}
	}
%>
  </dl>
</div>